package com.gitee.aurora.engine.vo;


import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * author: jiangfuxiao
 * Date:2022/9/24 18:49
 */
public class ResultSjzxData implements Serializable {

    //需要同步数据的省厅据中心ip
    private String stSjzxIp;
    //key 数据ip value 省厅数据中心需要同步的下级数据中心数据id集合
    private Map<String, List<Object>> groupSjzxData;
    //状态0正常 1异常
    private int status ;

    public void  setGroupSjzxDatas(StDataResultVo resultVo){
        this.groupSjzxData = new HashMap<>();
        //过滤出省厅数据中心需要同步的结果集返回给
        resultVo.getSjzxData().forEach(dataResultVo -> {
            List<Object> resultIds = dataResultVo.getSjzxIds().stream().filter( (sjzxId) ->
                    !resultVo.getStSjzxData().stream().map(value -> value.get("S_ID")).collect(Collectors.toList()).contains(String.valueOf(sjzxId)))
                    .collect(Collectors.toList());
            this.groupSjzxData.put(dataResultVo.getSjzxIp(),resultIds);
        });
    }

    public String getStSjzxIp() {
        return stSjzxIp;
    }

    public void setStSjzxIp(String stSjzxIp) {
        this.stSjzxIp = stSjzxIp;
    }

    public Map<String, List<Object>> getGroupSjzxData() {
        return groupSjzxData;
    }

    public void setGroupSjzxData(Map<String, List<Object>> groupSjzxData) {
        this.groupSjzxData = groupSjzxData;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
